import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;

/**
 * @author Simple
 * @date 2020/4/16 13:44
 */
public class Main {

    public static void main(String[] args) throws Exception {

        URL baidu = new URL("http://www.baidu.com");
        //字节流
        InputStream inputStream = baidu.openStream();
        //字符流
        InputStreamReader reader = new InputStreamReader(inputStream,"utf-8");
        //带缓冲的字符流
        BufferedReader bufferedReader = new BufferedReader(reader);
        String data = bufferedReader.readLine();
        while (data != null){
            System.out.println(data);
            data = bufferedReader.readLine();
        }
        bufferedReader.close();
        reader.close();
        inputStream.close();
    }

}
